package ar.com.sne.model.bo.per;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.log4j.Logger;

import ar.com.sne.bean.BaseBO;
import ar.com.sne.model.dao.factory.PerDAOFactory;

/**
 * PerCorredor
 * Clase encargada de encapsular la logica de Persona para el corredor.
 */

@Entity
@Table(name = "PER_CORREDORES", catalog = "sneweb")
public class PerCorredor extends BaseBO {

	private PerPersona perPersonas;

	@Transient
	Logger log = Logger.getLogger(PerCorredor.class);
	
	/*
	 * Contructores 
	 */
	
	public PerCorredor() {
		super();
	}
	
	/*
	 * Getter & Listters
	 */

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_persona")
	public PerPersona getPerPersonas() {
		return this.perPersonas;
	}

	public void setPerPersonas(PerPersona perPersonas) {
		this.perPersonas = perPersonas;
	}

	/*
	 * Metodos de Clase
	 */
	
	public static PerCorredor getById(Long id){
		return (PerCorredor) PerDAOFactory.getPerCorredorDAO().getById(id);
	}
	
	public static PerCorredor getByIdNull(Long id) {
		return (PerCorredor) PerDAOFactory.getPerCorredorDAO().getByIdNull(id);
	}
	
	public static List<PerCorredor> getList() {
		return (List<PerCorredor>) PerDAOFactory.getPerCorredorDAO().getList();
	}
	
	public static List<PerCorredor> getListActivos() {			
		return (List<PerCorredor>) PerDAOFactory.getPerCorredorDAO().getListActiva();
	}
}
